added sound and cleaned up code