added some crazy logic