Code org and few bug fixes
Code re-org