Added edge case, fixed limits