Moved curl code to separate file. Added append function.