heavily influenced by nosecomplete by @alonho