change .* to \s* in port regex
Add waste check
code clean up and limits tune