added stackoverflow error message and converted tabs to spaces