Added optparse

Instead of manually checking for parameters