Lab 5 - Cleaned up code