cleaned up structure and added tick event