Added some type checks in render lib functions.
Minor codestyle improvements in affected functions.
Fixes #248
Merge pull request #251 from awilliamson/renderChecks

Added some type checks in render lib functions.