Cleaned up file, addded debug info