Added JSHint items
Modified code be testable and wrote tests