added schema, general refactor