Modifying functionality from https://github.com/CodeSeven/toastr