soften the rough edges of the code

Some general enhancements..

@jepeteo I don't know if they conflict with anything that you are developing.. so review them and merge them as you like.