Refactorign to make it standalone bundle