working on internal logic