Removed bugs and clean up