Improve code by technicalpickles good advice