removed global validation function
refactor/fix middleware
started working on example