added schema and organizing code