refactoring and CIDR calc implemented