cleaned up code (from class)