cleaning up code and adding gif loader