Fixed functional, now it's working correct, with bugs of course.