Added timer and some minor improvements