Merge pull request #331 from dalkon/master

New functions & other
Potential crash fix

This might fix issue #333, description is too vague to tell.
Remove unused parameters
Remove unused variable