Code cleanup and added in/out ops