Fix issues for new code structure. Beautify code