Cleanup and Fix bugs