fixed some issues with code. Thanks, Scrutinizer!