Fixed bug and refactored code.