Initial version with modifications