commented for readability and removed unused code