Some bug fixes and code cleanup (deleting unwanted files)