New test, fix implementation using top and bottom values