Added 'smaller' and 'larger' function