Code cleaned up, commented