implementing logic