optimizing, commenting, renaming variables

renaming variables; small optimizations; adding comments, TODOs and
FIXMEs; removing unecessary lock/unlock (#129).
removing TODO, its not a bug.
Merge pull request #131 from ofabricio/master

optimizing, commenting, renaming variables