Fixed all issues pointed out by @V10lator