working on logic