cleaned up syntax and ineffective code