Refining functionality and fixing bugs