Cleaned up code for readability