Cleaned up code after @Retep998's changes.