Code Clean up
merging with ayoob's commits