minor fixes & code cleanup