- cleaned up and removed duplicate code