fixed erros, shuld be production ready