Fixed issues with original code