Fixed stuff so that we do not use inputstreams internally