this solution works reasonably good in short and middle environments