some code prettifications, time 'measurement'