Fixed all errors and couple of warnings