Fixed bug, cleaned up stuff