added time function and added sound engine