adding max & min;
bugfixing