Fixed issues from the comments