cleaned up code, completely finished