got logic!

working logic