Fixed a small bug and did some refactoring