Few more code fixes and cleanup