Added is_valid_size method for form validation, minor PEP8 cleanup