Adding better error handling and spring security