Updated code to match Java style