Fix formatting and some warnings