bug fix. Add error exceptions. Fix windows positioning. cleaning code.