Debugged. Now working