Cleaned up the code from the last version