master - added middleware
master - first working version