Fixed bug, need to clean up code.