changed most ints to bytes, fixed small bug in time math