refactor to use component based approach