Fixed issue: Minor fixes and cleanup

main fix in this PR