Utils cleanup

I had some free time and thought making some cleanup would help you contribute @marekpiechut.

@rgbkrk @marekpiechut Would you guys like to review this code?