refactoring + added interactive support
Started adding grid functions