Modified a bit. Need lots more work