Fixed Code as instructed by code review

Applied enumerated types and constants. Changed some variable names