Some comments added. Work on code re-organization started