add middleware spec and clean up
Merge branch '0.0.4' of github.com:Homestyle/telegram into 0.0.4