Added custom brackets, better exception handling