Code cleanup

- Code Cleanup (Unused Using ..., redundant Cast)
- Added null reference check