Minimal error handling and fixed some commenting