Fixed (?) awful timing code