some final fixes & code cleanup