Added try and catch cases and some little adds