Some debugging. Now working fully