Fixing bugs. Adding output