bug fixes and renamed file for clarity