finished intial logic