implemented basic logic