some fixes to make code concise and consistent