Refactor the apply_fd() function

Mainly just use Fortran 90 arrays throughout, that simplifies the syntax a lot.
Simplify the populate_weights() a bit
Merge pull request #2 from certik/refactoring

Refactoring