Error Fix

refactory code - its full .. bad  - many logical errors and awesome code style =\