Better Exceptionhandling && Cleaned code