Cleaned up certain parts of the code