Added platform neutrality, enhanced validations, refactored for readability