Fixed issues with the previous commit in a much cleaner fashion