Working on logic code