Fixed scheme defenition. Code cleanup