refactored codebase and added http support