Added checking for appropriate return statements