Remove unused function
Add additional sanity check