Error function waived into functions. Need to double check the error type and message.
Merge branch 'master' of https://github.com/puconghan/plt