cleanedup code via pullreview 2