Proper java way of doing stuff